package csel.model.skills;

import csel.model.CharacterStats;
import csel.model.DamageTypes;
import csel.model.Direction;
import csel.model.MoveAbilities;
import csel.model.Projectile;
import csel.model.Tile;
import csel.model.entity.Character;
import csel.model.entity.Entity;

public class FireBall extends RangedActiveSkill
{
    /**
     * Change this if we change its structure.
     */
    private static final long serialVersionUID = 5L;

	public FireBall(Character owner)
	{
		super(owner);
		setName("fireball");
		// TODO Auto-generated constructor stub
	}

	@Override
	public void use(Direction d, Tile t)
	{
		Integer manaUsed = getOwner().getCharacterStat(CharacterStats.ManaUsed);
		Integer manaLeft = getOwner().getCharacterStat(CharacterStats.CurrentMana);
		if(manaLeft >= 10)
		{
			if(Projectile.makeProjectile(getOwner().getGameGlobals(), t, d, new FireBallImpactor(this), 10, "fireball")!=null)
			{
				getOwner().setCharacterStat(CharacterStats.ManaUsed, manaUsed + 10);
			}
		}
	}

	@Override
	public void use(Entity e)
	{
		e.damage(DamageTypes.Electrical, 5*getPointsAllocated());
		e.pissTaitOff(getOwner());
	}
}
